home *** CD-ROM | disk | FTP | other *** search
/ BBS Toolkit / BBS Toolkit.iso / windows / brk.zip / BRK.EXE / BRK.WAS < prev   
Text File  |  1992-11-05  |  8KB  |  148 lines

  1. ;* Continually displays the status of CD, TRX, and RCV.                      *
  2. ;*****************************************************************************
  3. ;*                                                                           *
  4. ;* BRK.WAS                                                                   *
  5. ;* Copyright (C) 1992 Datastorm Technologies, Inc.                           *
  6. ;* All rights reserverd.                                                     *
  7. ;*                                                                           *
  8. ;* Purpose:                                                                  *
  9. ;* Script to display the status of received/transmitted data and the carrier *
  10. ;* detect signal.                                                            *
  11. ;*                                                                           *
  12. ;* This script uses icons in the accompanying file, "BRK.ICL"; because       *
  13. ;* Aspect runs at the same time as PCPLUS/Win, the script can be used during *
  14. ;* file transfers and such.  Run it during an XMODEM transfer!               *
  15. ;*                                                                           *
  16. ;* This ASPECT SCRIPT is intended only as a sample of ASPECT programming.    *
  17. ;* DATASTORM makes no warranty of any kind, express or implied, including    *
  18. ;* without limitation, any warranties of merchantability and/or fitness      *
  19. ;* for a particular purpose.  Use of this program is at your own risk.       *
  20. ;*                                                                           *
  21. ;* Written by Markus Pope                                                    *
  22. ;*                                                                           *
  23. ;*****************************************************************************
  24.  
  25. ;*****************************************************************************
  26. ;*                            GLOBAL VARIABLES                               *
  27. ;*****************************************************************************
  28.  
  29. string Icons="brk.icl"                 ; Storage file for the icons
  30. integer Pin_Trx=3,Pin_Rcv=3,Pin_Cd=3   ; Last value of the signals
  31. integer Exit_Flag=0                    ; Exit flag - when 1, script exits
  32.  
  33. ;*****************************************************************************
  34. ;* MAIN                                                                      *
  35. ;* This procedure is responsible for calling the dialog display routine and  *
  36. ;* getting the identification of the break box window.                       *
  37. ;*                                                                           *
  38. ;* Calls:   OpenDialog(), Brkbox()                                           *
  39. ;* Modifies Globals: none                                                    *
  40. ;*****************************************************************************
  41.  
  42. proc main
  43.    integer Win_Id=$ACTIVEWIN,Brk_Win   ; Storage variables for windows
  44.  
  45.    Brk_Win=OpenDialog()                ; Open dialog and get window handle
  46.    activatewin Win_Id                  ; Activate the previous window
  47.  
  48.    BrkBox(Win_Id,Brk_Win)              ; Call the break box procedure and
  49.    exit                                ; Exit the script
  50. endproc
  51.  
  52. ;****************************************************************************
  53. ;* OPEN_DIALOG                                                              *
  54. ;* Function used to display the main dialog box; returns the handle to the  *
  55. ;* calling procedure.                                                       *
  56. ;*                                                                          *
  57. ;* Calls:   none                                                            *
  58. ;* Modifies Globals: Pin_Trx, Pin_Rcv, Pin_Cd                               *
  59. ;* Returns: Pointer to BRKBOX window                                        *
  60. ;****************************************************************************
  61.  
  62. func OpenDialog : integer             ; Declare function to return integer
  63.  
  64.    ; Display the break box dialog box with the "off" icons.
  65.  
  66.    dialogbox 2 15 103 50 7 "Break v1.0"
  67.       icon 5 6 icons pin_trx
  68.       icon 40 6 icons pin_rcv
  69.       icon 75 6 icons pin_cd
  70.       text  7 32 18 8 center "TRX"
  71.       text  42 32 18 8 center "RCV"
  72.       text  77 32 18 8 center "CD"
  73.    enddialog
  74.  
  75.    return($ACTIVEWIN)                  ; Return handle to active window
  76. endfunc
  77.  
  78. ;****************************************************************************
  79. ;* BRK_BOX                                                                  *
  80. ;* This procedure checks the transmit/receive data buffers and the carrier  *
  81. ;* detect signal and updates the icons in the dialog box; the icons are     *
  82. ;* located in the "BRK.ICL" file.                                           *
  83. ;*                                                                          *
  84. ;* Calls:   ExitButton()                                                    *
  85. ;* Modifies Globals: Pin_Trx, Pin_Rcv, Pin_Cd                               *
  86. ;****************************************************************************
  87.  
  88. proc BrkBox
  89.    intparm Win_Id,Brk_Win              ; Handles to main and break windows
  90.  
  91.    integer TRX=0,RCV=0,CD=0,Last_Win   ; State of signals and last win handle
  92.    integer Update_Flag=0               ; Set if an update is to be done
  93.  
  94.    when DIALOG call ExitButton         ; Flip exit flag if any dialog event
  95.  
  96.    while !Exit_Flag                    ; Loop while the exit_flag is false
  97.  
  98.       if (win_id=$ACTIVEWIN)!=Last_Win ; Check to see if the current window
  99.          if Brk_Win==Win_Id            ; is the last window accessed; if so,
  100.             activatewin Last_Win       ; if the new window is the brk window
  101.          endif                         ; reset the window to last window.
  102.          Last_Win=$ACTIVEWIN           ; Set last_win to the current window
  103.       endif
  104.  
  105.       if $CARRIER && !(CD)             ; If CD is high and the CD icon is off,
  106.          CD=1,pin_cd=2                 ; turn it on.
  107.          Update_Flag = 1               ; Set the update flag to true
  108.       elseif !($CARRIER) && CD         ; If no carrier and the CD flag is set
  109.          CD=0,pin_cd=3                 ; then turn off the CD icon.
  110.          Update_Flag = 1               ; Set the update flag to true
  111.       endif
  112.  
  113.       if $TXCOUNT && !(TRX)            ; If data is being transmitted and the
  114.          TRX=1,Pin_Trx=2               ; transmit icon is off, turn it on.
  115.          Update_Flag = 1               ; Set the update flag to true
  116.       elseif !($TXCOUNT) && TRX        ; If data is not being transmitted and
  117.          TRX=0,Pin_Trx=3               ; the transmit icon is on, turn it off.
  118.          Update_Flag = 1               ; Set the update flag to true
  119.       endif
  120.  
  121.       if $RXCOUNT && !(RCV)            ; If data is being received and the
  122.          RCV=1,Pin_Rcv=2               ; receive icon is off, turn it on.
  123.          Update_Flag = 1               ; Set the update flag to true
  124.       elseif !($RXCOUNT) && RCV        ; If data is not being received and the
  125.          RCV=0,Pin_Rcv=3               ; receive icon is on, turn it off.
  126.          Update_Flag = 1               ; Set the update flag to true
  127.       endif
  128.       
  129.       if Update_Flag == 1              ; If the update flag is true, set it
  130.          Update_Flag = 0               ; to false and update the icons in the
  131.          updatedlg 2052                ; dialog box.
  132.       endif
  133.    endwhile
  134. endproc
  135.  
  136. ;****************************************************************************
  137. ;* EXIT_BUTTON                                                              *
  138. ;* This procedure sets the exit flag to true; the script will be exited,    *
  139. ;* and the dialog destroyed.                                                *
  140. ;*                                                                          *
  141. ;* Calls:   none                                                            *
  142. ;* Modifies globals: Exit_Flag                                              *
  143. ;****************************************************************************
  144.  
  145. proc ExitButton
  146.    Exit_Flag=1                         ; Set the exit flag to true
  147. endproc
  148.